package top.dingwen.io.treasure.api.base.request;

import top.dingwen.io.treasure.api.base.constant.ApiConstant;

import java.util.Map;

/**
 * BaseRequest : 统一外部入参对象
 * <p>对外RPC</p>
 *
 * @author dingwen
 * @since 2024/10/22 15:05
 */
@SuppressWarnings(ApiConstant.ALL)
public interface IBaseRequest {


    /**
     * 获取请求参数
     */
    Map<String, Object> getParams();

    /**
     * 设置请求参数
     */
    void setParams(Map<String, Object> params);

    /**
     * 添加参数
     *
     * @param paramKey   参数键
     * @param paramValue 参数值
     * @return {@link Map }<{@link String }, {@link Object }> 参数结果
     */
    default Map<String, Object> addParam(String paramKey, Object paramValue) {
        Map<String, Object> newParams = getParams();
        newParams.put(paramKey, paramValue);
        setParams(newParams);
        return newParams;
    }
}
